customElements.define(
    'wcs-btn-submit',
    class ButtonElement extends HTMLElement {
        constructor() {
            super();
            this.templateUrl = '/components/button/submit/index.html';
            this.templateId = 'wcs-btn-submit';
            this.init();
        }
        connectedCallback() {
            // 调用 update 方法来应用参数
        }
        // 更新内容的方法
        async init() {
            const template = await this.getTemplate();
            // 创建 Shadow DOM
            const shadow = this.attachShadow({ mode: 'open' });
            // 克隆模板内容并添加到 Shadow DOM
            const templateContent = template.cloneNode(true);
            shadow.appendChild(templateContent);
        }
        getTemplate() {
            const template = fetch(this.templateUrl)
                .then(response => response.text())
                .then(data => {
                    const parser = new DOMParser();
                    const doc = parser.parseFromString(data, 'text/html');
                    const template = doc.getElementById(this.templateId).content;
                    return template;
                });
            return template;
        }
    }
);
